/*
 * Copyright 2022 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.mx.ymate.serv;

import net.ymate.platform.core.beans.annotation.Ignored;
import net.ymate.platform.core.support.IInitialization;
import net.ymate.platform.serv.IClientCfg;
import net.ymate.platform.serv.IServerCfg;
import net.ymate.platform.serv.nio.INioCodec;

import java.util.Map;

/**
 * IMxServConfig generated By ModuleMojo on 2022/07/07 14:10
 *
 * @author YMP (https://www.ymate.net/)
 */
@Ignored
public interface IMxServConfig extends IInitialization<IMxServ> {

    String ENABLED = "enabled";
    String CLIENT = "client";
    String CODEC = "codec";
    String SERVER_NAME = "server.name";
    String SERVER_HOST = "server.host";
    String SERVER_PORT = "server.port";
    String SERVER_HANDLER = "server.handler";
    String SERVER_CHARSET = "server.charset";
    String SERVER_BUFFER_SIZE = "server.bufferSize";
    String SERVER_EXECUTOR_COUNT = "server.executorCount";
    String SERVER_KEEP_ALIVE_TIME = "server.keepAliveTime";
    String SERVER_THREAD_MAX_POOL_SIZE = "server.threadMaxPoolSize";
    String SERVER_THREAD_QUEUE_SIZE = "server.threadQueueSize";
    String SERVER_SELECTOR_COUNT = "server.selectorCount";
    String SERVER_PARAMS = "server.params";
    String CLIENT_NAME = "client.name";
    String CLIENT_REMOTE_HOST = "client.remoteHost";
    String CLIENT_PORT = "client.port";

    String CLIENT_HANDLER = "client.handler";
    String CLIENT_CHARSET = "client.charset";
    String CLIENT_BUFFER_SIZE = "client.bufferSize";
    String CLIENT_EXECUTOR_COUNT = "client.executorCount";
    String CLIENT_CONNECTION_TIMEOUT = "client.connectionTimeout";
    String CLIENT_RECONNECTION_INTERVAL = "client.reconnectionInterval";
    String CLIENT_HEARTBEAT_INTERVAL = "client.heartbeatInterval";
    String CLIENT_PARAMS = "client.params";

    String SERVER_CLIENT_SERVER = "server";
    String SERVER_CLIENT_CLIENT = "client";

    /**
     * 模块是否已启用, 默认值: true
     *
     * @return 返回false表示禁用
     */
    boolean isEnabled();

    /**
     * 获取编/解码器
     *
     * @return 获取编/解码器
     */
    INioCodec getCodec();

    /**
     * 获取启动的端
     * @return
     */
    String getClient();

    /**
     * 获取服务名称
     *
     * @return 返回服务名称
     */
    String getServerName();

    /**
     * 获取主机名称或IP地址
     *
     * @return 返回主机名称或IP地址
     */
    String getServerHost();

    /**
     * 获取服务监听端口
     *
     * @return 返回服务监听端口
     */
    int getServerPort();

    /**
     * 获取服务端处理类
     * @return
     */
    IServerHandler getServerHandler();

    /**
     * 获取字符编码
     *
     * @return 返回字符编码
     */
    String getServerCharset();

    /**
     * 获取缓冲区大小
     *
     * @return 返回缓冲区大小
     */
    int getServerBufferSize();

    /**
     * 获取执行线程数量，默认为 Runtime.getRuntime().availableProcessors()
     *
     * @return 返回执行线程数量
     */
    int getServerExecutorCount();

    /**
     * 获取空闲线程等待新任务的最长时间, 默认为 0
     *
     * @return 返回空闲线程等待新任务的最长时间
     */
    long getServerKeepAliveTime();

    /**
     * 获取最大线程池大小，默认为 200
     *
     * @return 返回最大线程池大小
     */
    int getServerThreadMaxPoolSize();

    /**
     * 获取线程队列大小，默认为 1024
     *
     * @return 返回线程队列大小
     */
    int getServerThreadQueueSize();

    /**
     * 获取选择器数量
     *
     * @return 返回选择器数量
     */
    int getServerSelectorCount();

    /**
     * 获取 服务端自定义参数映射
     *
     * @return 返回服务端自定义参数映射
     */
    Map<String, String> getServerParams();

    /**
     * 获取客户端名称
     *
     * @return 返回客户端名称
     */
    String getClientName();

    /**
     * 获取客户端端处理类
     * @return
     */
    IClientHandler getClientHandler();

    /**
     * 获取远程主机名称或IP地址
     *
     * @return 返回远程主机名称或IP地址
     */
    String getClientRemoteHost();

    /**
     * 获取远程服务监听端口
     *
     * @return 返回远程服务监听端口
     */
    int getClientPort();

    /**
     * 获取字符编码
     *
     * @return 返回字符编码
     */
    String getClientCharset();

    /**
     * 获取缓冲区大小
     *
     * @return 返回缓冲区大小
     */
    int getClientBufferSize();

    /**
     * 获取执行线程数量
     *
     * @return 返回执行线程数量
     */
    int getClientExecutorCount();

    /**
     * 获取连接超时时间(秒)
     *
     * @return 返回连接超时时间
     */
    int getClientConnectionTimeout();

    /**
     * 获取断线重连检测间隔(秒)
     *
     * @return 返回断线重连检测间隔
     */
    int getClientReconnectionInterval();

    /**
     * 获取心跳包发送间隔(秒)
     *
     * @return 返回心跳包发送间隔
     */
    int getClientHeartbeatInterval();

    /**
     * 获取客户端自定义参数映射
     *
     * @return 返回客户端自定义参数映射
     */
    Map<String, String> getClientParams();

    /**
     * 转换服务端配置
     * @return
     */
    IServerCfg toServerCfg();

    /**
     * 转换客户端配置
     * @return
     */
    IClientCfg toClientCfg();
}